package post_to_in_pkg.node;
import post_to_in_pkg.lexer.Token;
import post_to_in_pkg.parser.Type;

public class OperandNode extends Node{
	 private Type type;
	 private Token operand;
	 private boolean is_const_str=false;
	public OperandNode(Token tok,Type T) {
		type=T; operand=tok;
	}
	
	public String toString() {
		return " "+operand.toString()+"; ";
	}
	
	public Token getToken() {
		return operand;
	}
	
	public boolean isReturnVoid() {
		return false;
	}
	
	public boolean isTempNode() {
		return type==Type.TEMPVAR;
	}
	
	public void changeToConstStrOpnode(){
		is_const_str=true;
	}

	public boolean isConstStr(){
		return is_const_str;
	}

	public String getName() {
		return operand.toString();
	}

	@Override
	public boolean hasChild() {
		// TODO Auto-generated method stub
		if(this instanceof TempNode) {
			return true;
		}
		else
			return false;
	}

	@Override
	public void printChild(StringBuffer content) {
		// TODO Auto-generated method stub
		if(hasChild()) {
			((TempNode)this).printChild(content);
		}
		else {
			content=content.insert(0,toString());
		}
	}
}
